| *Keyword*                 |                                 |                                                     |                                    |                                             |                      |   |
| Create ruleset            | [Documentation]                 | Create a ruleset                                    |                                    |                                             |                      |   |
|                           | [Arguments]                     | ${name}=${DEFAULT_RULESET}                          | ${source}=${DEFAULT_SOURCE}        |                                             |                      |   |
|                           | SN Go To                        | ${BASE_URL}rules/ruleset/add                        |                                    |                                             |                      |   |
|                           | Input Text                      | id_name                                             | ${name}                            |                                             |                      |   |
|                           | SN Click Element                | xpath=//label[text()=' ${source}@HEAD']             |                                    |                                             |                      |   |
|                           | SN Click Element                | xpath=//button[@type='submit']                      |                                    |                                             |                      |   |
|                           | ${loc}=                         | Get Location                                        |                                    |                                             |                      |   |
|                           | Page Should Not Contain Element | xpath=//button[@type='submit']                      |                                    |                                             |                      |   |
|                           | ${prefix}=                      | Regexp Escape                                       | ${BASE_URL}                        |                                             |                      |   |
|                           | Should Match Regexp             | ${loc}                                              | ${prefix}rules\\/ruleset\\/\\d+\\/ |                                             |                      |   |
|                           | Page Should Contain             | ${name}                                             |                                    |                                             |                      |   |
|                           | Enable ruleset categories       | name=${name}                                        |                                    |                                             |                      |   |
| Enable ruleset categories | [Documentation]                 | Enables all the categories of a ruleset             |                                    |                                             |                      |   |
|                           | [Arguments]                     | ${name}=${DEFAULT_RULESET}                          |                                    |                                             |                      |   |
|                           | SN Go To                        | ${BASE_URL}rules/ruleset/                           |                                    |                                             |                      |   |
|                           | SN Click Element                | link=${name}                                        |                                    |                                             |                      |   |
|                           | ${loc}=                         | Get Location                                        |                                    |                                             |                      |   |
|                           | ${prefix}=                      | Regexp Escape                                       | ${BASE_URL}                        |                                             |                      |   |
|                           | Should Match Regexp             | ${loc}                                              | ${prefix}rules\\/ruleset\\/\\d+\\/ |                                             |                      |   |
|                           | ${prefix}=                      | Regexp Escape                                       | ${loc}                             |                                             |                      |   |
|                           | Debug Screenshot                |                                                     |                                    |                                             |                      |   |
|                           | SN Click Element                | link=Edit                                           |                                    |                                             |                      |   |
|                           | Debug Screenshot                |                                                     |                                    |                                             |                      |   |
|                           | SN Click Element                | link=Edit categories                                |                                    |                                             |                      |   |
|                           | ${loc}=                         | Get Location                                        |                                    |                                             |                      |   |
|                           | Debug Screenshot                |                                                     |                                    |                                             |                      |   |
|                           | Should Match Regexp             | ${loc}                                              | ${prefix}edit\\?mode=categories    |                                             |                      |   |
|                           | SN Click Element                | xpath=//input[contains(@onclick, 'tables2_toggle')] |                                    |                                             |                      |   |
|                           | Debug Screenshot                |                                                     |                                    |                                             |                      |   |
|                           | SN Click Element                | xpath=//input[@type='submit']                       |                                    |                                             |                      |   |
|                           | Debug Screenshot                |                                                     |                                    |                                             |                      |   |
|                           | ${loc}=                         | Get Location                                        |                                    |                                             |                      |   |
|                           | Should Match Regexp             | ${loc}                                              | ${prefix}                          |                                             |                      |   |
| Delete ruleset            | [Documentation]                 | Delete a ruleset                                    |                                    |                                             |                      |   |
|                           | [Arguments]                     | ${name}=${DEFAULT_RULESET}                          |                                    |                                             |                      |   |
|                           | SN Go To                        | ${BASE_URL}rules/ruleset/                           |                                    |                                             |                      |   |
|                           | SN Click Element                | link=${name}                                        |                                    |                                             |                      |   |
|                           | ${loc}=                         | Get Location                                        |                                    |                                             |                      |   |
|                           | ${prefix}=                      | Regexp Escape                                       | ${BASE_URL}                        |                                             |                      |   |
|                           | Should Match Regexp             | ${loc}                                              | ${prefix}rules\\/ruleset\\/\\d+\\/ |                                             |                      |   |
|                           | ${prefix}=                      | Regexp Escape                                       | ${loc}                             |                                             |                      |   |
|                           | SN Click Element                | link=Delete                                         |                                    |                                             |                      |   |
|                           | ${loc}=                         | Get Location                                        |                                    |                                             |                      |   |
|                           | Debug Screenshot                |                                                     |                                    |                                             |                      |   |
|                           | Should Match Regexp             | ${loc}                                              | ${prefix}delete                    |                                             |                      |   |
|                           | SN Click Element                | xpath=//button[@type='submit']                      |                                    |                                             |                      |   |
| Clean rulesets            | [Documentation]                 | Remove all rulesets                                 |                                    |                                             |                      |   |
|                           | :FOR                            | ${i}                                                | IN RANGE                           | 64                                          |                      |   |
|                           | \                               | SN Go To                                            | ${BASE_URL}rules/ruleset/          |                                             |                      |   |
|                           | \                               | ${no_object}=                                       | Run Keyword And Return Status      | Page Should Contain                         | No object available. |   |
|                           | \                               | Return From Keyword If                              | ${no_object} == 1                  |                                             |                      |   |
|                           | \                               | ${name}=                                            | Get Table Cell                     | xpath=//div[@class='table-container']/table | 2                    | 1 |
|                           | \                               | Log                                                 | ${name}                            |                                             |                      |   |
|                           | \                               | Delete ruleset                                      | name=${name}                       |                                             |                      |   |
